package de.mhu.mandalaui.text;

import java.util.Iterator;

import de.mhu.mandalaui.AbstractComposite.Container;
import de.mhu.mandalaui.Response;
import de.mhu.mandalaui.TextComposit;

public class Paragraph extends Text implements Iterable<Container<Text, Object>> {

	TextComposit composit = new TextComposit();
	
	public Paragraph() {
		composit.componentAttach(this);
	}

	public Paragraph(String text) {
		this();
		composit.add(new Text(text));
	}
	
	public Paragraph(Text ... texts) {
		this();
		composit.add(texts);
	}
	
	
	
	public void add(Text... items) {
		composit.add(items);
	}

	public Object remove(Text item) {
		return composit.remove(item);
	}

	public Text remove(int index) {
		return composit.remove(index);
	}

	public Iterator<Container<Text, Object>> iterator() {
		return composit.iterator();
	}

	public void removeAll() {
		composit.removeAll();
	}

	@Override
	public void render(Response response) {
		response.startTag("p",null,this);
		composit.render(response);
		response.endTag("p");
	}
}
